<!DOCTYPE html>
<html>
  <head>
    <title>datalink.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
	<script type="text/javascript" src="../javascript/lib/jquery-1.9.1/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="../javascript/lib/plusin/jquery.datalink.js"></script>
	<script type="text/javascript">
		$(function(){
			var registration = {};
			$("form").link(registration);
			
			//设置一些默认值
			//$(registration).setField("name" , "New User Registration");
			//$(registration).setField("email" , "i_dont_exist@mail.com");
			
			$("form").change(function(){
				alert(registration.name + " " + registration.email);
			})
		})
	</script>
  </head>
  
  <body>
    <form method="post">
    	<!-- html5支持required，并非所有浏览器都支持html5和required标签 -->
    	<label for="name">User name </label>
    	<input type="text" name="name" required >
    	
    	<label for="email">email </label>
    	<input type="email" name="email" required/>
    	<!-- 必须为submit才对required起作用 -->
    	<input type="submit" value="send it" />
    </form>
  </body>
</html>
